package com.smarttiger.zero.admin.dao;

import com.smarttiger.zero.admin.entity.UsersModel;
import com.smarttiger.zero.admin.entity.WhiteListModel;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface WhiteListDao extends BaseDao<WhiteListModel> {

    public List<WhiteListModel> findAllByInterfaceId(String interfaceId);

    @Modifying
    @Query("delete from WhiteListModel es where es.interfaceId = ?1")
    public void deleteByInterfaceId(String id);

    @Query("select u from UsersModel u inner join WhiteListModel wl on u.id = wl.usersId where wl.interfaceId = ?1 ")
    public List<UsersModel> queryWhiteListModelByInterfaceId(String interfaceId);


}
